<template>
    <MyDialog ref="dialog" v-bind="$attrs" @confirm="confirm">
        <MyForm ref="form" v-bind="$attrs" v-on="$listeners"></MyForm>
    </MyDialog>
</template>

<script>
    export default {
        name:"DF",
        mounted () {
            const {hide,start,stop}=this.$refs.dialog;
            Object.assign(this,{hide,start,stop});
        },
        methods:{
            /**
             * 显示
             */
            show(){
               this.$refs.dialog.show();
               this.$nextTick(()=>{
                this.$refs.form.clear();
               });
            },
            /**
             * 点击确定按钮
             */
          async confirm(){
              try {
                await this.$refs.form.validate();
                this.$emit('confirm');
              } catch (error) {
                console.log(error);
              }
           }
        }
    }
</script>

<style lang="scss" scoped>

</style>